package HashMap;

import java.util.HashMap;

/**
 * @author lijunhao
 * 2023/7/17
 * @description TODO
 */
public class TestClass {
    public static void main(String[] args) {
        HashMap<User, String> userMap = new HashMap<>();

        User user1 = new User("John", "password123");
        User user2 = new User("John", "password123");
        User user3 = new User("Alice", "password123");

        userMap.add(user1, "User 1");
        userMap.add(user2, "User 2");
        userMap.add(user3, "User 3");

        System.out.println(userMap.size());  // 输出2，因为user2和user1被视为同一元素，只有一个被添加进去
    }
}
